package HashMap;

import MapClass.Studnt;

import java.util.*;

public class HashMap {
    public static void main(String[] args) {
        Map<Integer,String> map =new java.util.HashMap<>();
        map.put(1,"fugui");
        map.put(2,"wenwen");
        map.put(3,"lisa");
        map.put(3,"lisaya");
        System.out.println(map.size());
        //创建递归对象
        Set<Map.Entry<Integer,String>>set =map.entrySet();
        //增强for遍历集合
        for (Map.Entry<Integer,String> s:set) {
            System.out.println(s.getKey()+"="+s.getValue());
        }
        Studnt s1 =new Studnt("zhangsan");
        Studnt s2 =new Studnt("zhangsan");
        System.out.println(s1.equals(s2));
        System.out.println("s1的hashCode"+s1.hashCode());
        System.out.println("s2的hashCode"+s2.hashCode());
        Set<Studnt> studnts =new HashSet<>();
        studnts.add(s1);
        studnts.add(s2);
        System.out.println(studnts.size());

    }

}
